package com.kmust.dream.wanderingdream.order.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 
 * @TableName order
 */
@TableName(value ="`order`")
@Data
@Accessors(chain = true)
public class Order implements Serializable {
    /**
     * 订单id
     */
    @TableId(value = "order_id", type = IdType.AUTO)
    private Integer orderId;

    /**
     * 用户名，实为外键，为便不设
     */
    @TableField(value = "username")
    private String username;

    /**
     * 商品id
     */
    @TableField(value = "product_sku_id")
    private Integer productSkuId;

    /**
     * 购买的数量
     */
    @TableField(value = "order_number")
    private Integer orderNumber;

    /**
     * 订单金额
     */
    @TableField(value = "order_amount")
    private Double orderAmount;

    /**
     * 订单的创建时间
     */
    @TableField(value = "order_create_time")
    private Date orderCreateTime;

    /**
     * 订单的状态，0表示未支付，1表示未发货，2表示未收货，3表示未评价，4表示订单已经完成
     */
    @TableField(value = "order_status")
    private String orderStatus;

    /**
     * 订单是否显示，如果删除则置为0，表示不显示该订单
     */
    @TableField(value = "order_show")
    private Boolean orderShow;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Order other = (Order) that;
        return (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
            && (this.getProductSkuId() == null ? other.getProductSkuId() == null : this.getProductSkuId().equals(other.getProductSkuId()))
            && (this.getOrderNumber() == null ? other.getOrderNumber() == null : this.getOrderNumber().equals(other.getOrderNumber()))
            && (this.getOrderAmount() == null ? other.getOrderAmount() == null : this.getOrderAmount().equals(other.getOrderAmount()))
            && (this.getOrderCreateTime() == null ? other.getOrderCreateTime() == null : this.getOrderCreateTime().equals(other.getOrderCreateTime()))
            && (this.getOrderStatus() == null ? other.getOrderStatus() == null : this.getOrderStatus().equals(other.getOrderStatus()))
            && (this.getOrderShow() == null ? other.getOrderShow() == null : this.getOrderShow().equals(other.getOrderShow()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getProductSkuId() == null) ? 0 : getProductSkuId().hashCode());
        result = prime * result + ((getOrderNumber() == null) ? 0 : getOrderNumber().hashCode());
        result = prime * result + ((getOrderAmount() == null) ? 0 : getOrderAmount().hashCode());
        result = prime * result + ((getOrderCreateTime() == null) ? 0 : getOrderCreateTime().hashCode());
        result = prime * result + ((getOrderStatus() == null) ? 0 : getOrderStatus().hashCode());
        result = prime * result + ((getOrderShow() == null) ? 0 : getOrderShow().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", orderId=").append(orderId);
        sb.append(", username=").append(username);
        sb.append(", productSkuId=").append(productSkuId);
        sb.append(", orderNumber=").append(orderNumber);
        sb.append(", orderAmount=").append(orderAmount);
        sb.append(", orderCreateTime=").append(orderCreateTime);
        sb.append(", orderStatus=").append(orderStatus);
        sb.append(", orderShow=").append(orderShow);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}